package com.hongying.lingtianxiang;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.Ellipse2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

public class StringDemo {
    private static BufferedImage image;

    private static Graphics2D graphics;
    public static void main(String[] args) throws IOException {
        init();
        Ellipse2D ellipse=new Ellipse2D.Double(50,50,300,200);
        graphics.draw(ellipse);
        graphics.fill(ellipse);
        graphics.dispose();
        ImageIO.write(image,"png", new File("C:\\Users\\qwer\\Desktop\\a\\a.png"));
    }

    public static void init(){
        int width=480,hight=720;
        image = new BufferedImage(width,hight, BufferedImage.TYPE_INT_RGB);
        //获取图形上下文
        graphics = (Graphics2D)image.getGraphics();
    }

    public static String toUnicode(String s) {
        String as[] = new String[s.length()];
        String s1 = "";
        for (int i = 0; i < s.length(); i++) {
            as[i] = Integer.toHexString(s.charAt(i) & 0xffff);
            s1 = s1 + "\\u" + as[i];
        }
        return s1;
    }
}
